package com.test.personalblogproject.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.test.personalblogproject.pojo.Article;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

@Mapper
public interface ArticleMapper {
    @Insert("insert into ms_article (title, summary, author_id, category_id, create_date, comment_counts, view_counts, weight) " +
            "values (#{title}, #{summary}, #{authorId}, #{categoryId}, #{createDate}, #{commentCounts}, #{viewCounts}, #{weight})")
    @Options(useGeneratedKeys = true, keyProperty = "id")   // 让插入后主键自动回填
    void insert(Article article);
}
